<cfinvoke component="components.data" method="category" returnvariable="categorys">
<cfinvoke component="components.data" method="five_star_area_category" returnvariable="area">
<cfinvoke component="components.data" method="expertise" returnvariable="expertise">
<cfinvoke component="components.data" method="current_selections" returnvariable="selections">
<cfparam default="0" name="url.action">
<cfcontent reset="yes">
<cfswitch expression="#url.action#"> 

<cfcase value="get_report">
<cfinvoke component="components.data" method="get_report_data" returnvariable="list_reports" id="#id#">

<cfset result_message = ''>
	<cfset result_message = '{"reports":['>
	
	<cfloop list="#list_reports.poc_id#" index="i">
	
<cfquery name="selections" datasource="#session.dsn#" >
select * from poc_detail where poc_id = #i#
</cfquery><cfif selections.poc_id neq "">
		<cfset result_message =  result_message & '{"poc_id":"' & Session.helpers.add_json_escapement(selections.poc_id) & '","first_name":"' & Session.helpers.add_json_escapement(selections.first_name) & '","last_name":"' & Session.helpers.add_json_escapement(selections.last_name) &  '","email":"' & Session.helpers.add_json_escapement(selections.email) &  '"},'>
		</cfif>
	</cfloop>
	<cfset result_message = Session.helpers.remove_comma_from_end_of_string(result_message)>
	<cfset result_message = result_message & ']}'>
<cfcontent type="text/html" reset="yes"><cfoutput>#result_message#</cfoutput>	
</cfcase>

<cfcase value="delete_poc">
<cfinvoke component="components.data" method="get_report_data" returnvariable="list_reports" id="#report_id#">
<cfset newlist = "">
<cfset tmp = listfind(list_reports.poc_id,id,",")>
<cfset newlist = listdeleteat(list_reports.poc_id,tmp,",")>
<cfquery datasource="#session.dsn#" name="update">
update five_star_reports
set
poc_id = '#newlist#'
where report_id = #report_id#
</cfquery>

<cfinvoke component="components.data" method="get_report_data" returnvariable="list_reports" id="#report_id#">
<cfset result_message = ''>
	<cfset result_message = '{"report_poc":['>
	<cfloop list="#list_reports.poc_id#" index="i">
<cfquery name="selections" datasource="#session.dsn#" >
select * from poc_detail where poc_id = #i#
</cfquery>
		<cfset result_message =  result_message & '{"poc_id":"' & Session.helpers.add_json_escapement(selections.poc_id) & '","first_name":"' & Session.helpers.add_json_escapement(selections.first_name) & '","last_name":"' & Session.helpers.add_json_escapement(selections.last_name) & '","email":"' & Session.helpers.add_json_escapement(selections.email) &  '"},'>
	</cfloop>
	<cfset result_message = Session.helpers.remove_comma_from_end_of_string(result_message)>
	<cfset result_message = result_message & ']}'>

<cfcontent type="text/html" reset="yes"><cfoutput>#result_message#</cfoutput>
</cfcase>


<cfcase value="view_pdf">
<cfinvoke component="components.data" method="get_report_data" returnvariable="list_reports" id="#report_id#">
none
</cfcase>

</cfswitch>